package com.cd.form.jpa.domian;

import com.cd.common.domain.BaseDomain;
import com.cd.form.dto.ResultDataDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "db_form_result",
        indexes = {
                @Index(name = "idx_form_id", columnList = "form_id")
        })
@NoArgsConstructor
@AllArgsConstructor
public class FormResult extends BaseDomain {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "result_id")
    private Long resultId;

//    @Column(name = "user_id")
//    private Long userId; // 可为空
//
//    @Column(name = "form_id")
//    private Long formId;

    @Column(name = "form_id")
    private Long formId;

    @Column(name = "data", length = 8000)
    private String data;

    @Column(name = "create_time")
    private Date createTime = new Date();

    //user_id
    @Column(name = "user_id")
    private Long userId;

    //结果审批状态

    //0:待审批 1:通过 2:拒绝 3:无需审批 4:待处理/暂定 有点鸡肋
    @Column(name = "status")
    private Integer status = 0;

    //用于组装完成后向前端输出的dto
    @Transient
    private List<ResultDataDto> resultDataDtos;
}